package io.openkunlun.javarpc.codegen;

import java.util.HashMap;
import java.util.Map;

final class RpcUtils {

    static final Map<String, String> PRIMITIVE_TYPES;

    static {
        PRIMITIVE_TYPES = new HashMap<>();
        PRIMITIVE_TYPES.put("void", Void.class.getName());
        PRIMITIVE_TYPES.put("boolean", Boolean.class.getName());
        PRIMITIVE_TYPES.put("byte", Byte.class.getName());
        PRIMITIVE_TYPES.put("char", Character.class.getName());
        PRIMITIVE_TYPES.put("short", Short.class.getName());
        PRIMITIVE_TYPES.put("int", Integer.class.getName());
        PRIMITIVE_TYPES.put("long", Long.class.getName());
        PRIMITIVE_TYPES.put("float", Float.class.getName());
        PRIMITIVE_TYPES.put("double", Double.class.getName());

    }

    /**
     * @param originType
     * @return
     */
    static String castType(String originType) {
        return PRIMITIVE_TYPES.getOrDefault(originType, originType);
    }

}
